package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.entity.Category;
import com.sky.enumeration.OperationType;
import io.swagger.v3.oas.models.security.SecurityScheme;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: WangHongKun
 * @Date: 2022/9/22 16:58
 * @Email: 2028911483@qq.com
 * @Phone: 18683977706
 */

@Mapper
public interface CategoryMapper {
    @AutoFill(value = OperationType.UPDATE)
    void  Update(Category category);



    List<Category>  PageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Update("updateNumber category set  status =#{status} where id =#{id}")
    void startOrStop(Integer status, long id);

    @AutoFill(OperationType.INSERT)
    void add(Category category);

    @Delete("delete from category where  id =#{id}")
    void delete(long id);

    @Select("select * from category where type =#{type} ")
    List<Category> getBYType(Integer type);


    @Select("select * from  category")
    List<Category>  getAll();
}
